//
//  ColorPickerCellViewModel.swift
//  PorscheRegistration
//
//  Created by Jinzhu Liu on 2023/11/22.
//

import Foundation
import Combine
import UIKit

protocol ColorPickerCellViewModelInputType { }

protocol ColorPickerCellViewModelOutputType {
    var color: UIColor { get }
    var name: String { get }
    var dataModel: AvatarColor { get }
}

protocol ColorPickerCellViewModelType {
    var input: ColorPickerCellViewModelInputType { get }
    var output: ColorPickerCellViewModelOutputType { get }
}

class ColorPickerCellViewModel: ColorPickerCellViewModelType,
                                ColorPickerCellViewModelInputType,
                                ColorPickerCellViewModelOutputType {
    
    var input: ColorPickerCellViewModelInputType { self }
    var output: ColorPickerCellViewModelOutputType { self }
    
    var color: UIColor {
        dataModel.color
    }
    
    var name: String {
        dataModel.name
    }
    
    var dataModel: AvatarColor
    
    init(dataModel: AvatarColor) {
        self.dataModel = dataModel
    }
    
    convenience init(color: UIColor, name: String) {
        let dataModel = AvatarColor(color: color, name: name)
        self.init(dataModel: dataModel)
    }
}
